package com.example.my0609projects;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.ListView;

import com.example.my0609projects.bean.Mystl;

import java.util.ArrayList;
import java.util.List;

public class Main2Activity extends AppCompatActivity {
    ListView listView;
    MyAdpater adpater;
    List<Mystl>list;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        list=new ArrayList<>();
        listView=findViewById(R.id.listview);
        adpater=new MyAdpater(list,this);
        listView.setAdapter(adpater);
        add();
    }
    void add(){
        for (int i=1;i<41;i++){
            if (i%2==0) {
                String title1 = "aaaaaaaaaa" + i;
                String author = "bbb" + i;
                String time = "2020.06.09." + i;
                Mystl mystl = new Mystl(title1, author, time);
                list.add(mystl);
                mystl.setType(0);
            }else{
                String title1 = "AAAAAAAAA" + i;
                String author1 = "BBB" + i;
                String time1 = "2020.06.09." + i;
                Mystl mystl = new Mystl(title1, author1, time1);
                list.add(mystl);
                mystl.setType(1);
            }
        }
    }
}
